/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.trumah.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

/**
 *
 * @author rafaell
 */
@Entity
@Table(name = "Funcionario")
@Inheritance(strategy=InheritanceType.JOINED)
@NamedQueries({@NamedQuery(name = "Funcionario.findAll", query = "SELECT f FROM Funcionario f"), @NamedQuery(name = "Funcionario.findById", query = "SELECT f FROM Funcionario f WHERE f.id = :id"), @NamedQuery(name = "Funcionario.findByMatricula", query = "SELECT f FROM Funcionario f WHERE f.matricula = :matricula")})
@PrimaryKeyJoinColumn(name="id")
public class Funcionario extends Pessoa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "matricula")
    private Long matricula;
    @OneToMany(mappedBy = "funcionarioId")
    private List<AssistenteSocial> assistenteSocialList;
    @OneToMany(mappedBy = "funcionarioId")
    private List<AssistenteLogistica> assistenteLogisticaList;
    @JoinColumn(name = "pessoa_id", referencedColumnName = "id")
    @ManyToOne
    private Pessoa pessoaId;
    @JoinColumn(name = "usuario_id", referencedColumnName = "id")
    @ManyToOne
    private Usuario usuarioId;
    @OneToMany(mappedBy = "funcionarioId")
    private List<Rota> rotaList;
    @OneToMany(mappedBy = "funcionarioId")
    private List<Atendente> atendenteList;

    public Funcionario() {
    }

    public Funcionario(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMatricula() {
        return matricula;
    }

    public void setMatricula(Long matricula) {
        this.matricula = matricula;
    }

    public List<AssistenteSocial> getAssistenteSocialList() {
        return assistenteSocialList;
    }

    public void setAssistenteSocialList(List<AssistenteSocial> assistenteSocialList) {
        this.assistenteSocialList = assistenteSocialList;
    }

    public List<AssistenteLogistica> getAssistenteLogisticaList() {
        return assistenteLogisticaList;
    }

    public void setAssistenteLogisticaList(List<AssistenteLogistica> assistenteLogisticaList) {
        this.assistenteLogisticaList = assistenteLogisticaList;
    }

    public Pessoa getPessoaId() {
        return pessoaId;
    }

    public void setPessoaId(Pessoa pessoaId) {
        this.pessoaId = pessoaId;
    }

    public Usuario getUsuarioId() {
        return usuarioId;
    }

    public void setUsuarioId(Usuario usuarioId) {
        this.usuarioId = usuarioId;
    }

    public List<Rota> getRotaList() {
        return rotaList;
    }

    public void setRotaList(List<Rota> rotaList) {
        this.rotaList = rotaList;
    }

    public List<Atendente> getAtendenteList() {
        return atendenteList;
    }

    public void setAtendenteList(List<Atendente> atendenteList) {
        this.atendenteList = atendenteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Funcionario)) {
            return false;
        }
        Funcionario other = (Funcionario) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "trumah.Funcionario[id=" + id + "]";
    }

}
